'use strict';
module.exports = {
	/**
	 * 获取课程列表和选中用户拥有情况
	 * @url admin/system/user/sys/getUserCourseList 前端调用的url参数地址
	 * data 请求参数
	 * @param {String} params1  参数1
	 */
	main: async (event) => {
		let { data = {}, userInfo, util, filterResponse, originalParam } = event;
		let { customUtil, uniID, config, pubFun, vk, db, _ } = util;
		let { uid, formData } = data;
		let res = { code: 0, msg: "" };
		// 业务逻辑开始-----------------------------------------------------------
		let dbName = "course";
		res = await vk.baseDao.getTableData({
			dbName,
			data,
			foreignDB: [{
				dbName: "course_category",
				localKey: "category_id",
				foreignKey: "_id",
				as: "category",
				limit: 1,
			}, {
				dbName: "user_goods",
				localKey: "_id",
				foreignKey: "goods_id",
				as: "user_buy",
				limit: 1,
				whereJson: { user_id: formData.user_id }
			}]
		});

		// 业务逻辑结束-----------------------------------------------------------
		return res;
	}
}
